class GoodsEntity {
  int? _id;
  String? _name;
  String? _imageUrl;
  double? _price;

  static GoodsEntity fromJson(Map<String, dynamic> json) {
    GoodsEntity goodsEntity = GoodsEntity();
    goodsEntity._id = json['id'];
    goodsEntity._name = json['name'];
    goodsEntity._imageUrl = json['image_url'];
    goodsEntity._price = json['price'];
    return goodsEntity;
  }

  static List<GoodsEntity> getMockGoodsEntities() {
    return List.generate(
      20,
      (index) => GoodsEntity.fromJson(
        {'id': index + 1, 'name': '商品$index', 'imageUrl': '', 'price': (index + 1) * 10.5},
      ),
    );
  }

  int get id => _id!;
  String get name => _name!;
  String get imageUrl => _imageUrl!;
  double get price => _price!;
}
